import request from '@/utils/request.js'

export const login = (data) => {
   return request({
      url: '/login',
      method: 'post',
      data
   })
}

export const getDept = () => {
   return request({
      url: '/department',
      method: 'get'
   })
}

export const changeUserAvatar = (id, sourUrl) => {
   return request({
      url: '/user/avatar',
      method: 'post',
      data: {
         id,
         sourUrl
      }
   })
}

export const getUserInfo = (id, roleId) => {
   return request({
      url: `/user/${id}/${roleId}`,
      method: 'get'
   })
}

export const addReport = (data) => {
   return request({
      url: '/report',
      method: 'post',
      data
   })
}

export const sendPhoneCode = (phone) => {
   return request({
      url: `/code/${phone}`,
      method: 'get'
   })
}

export const verifyCode = (data) => {
   return request({
      url: '/code/verify',
      method: 'post',
      data
   })
}